#!/bin/bash
set -e

if [ "$1" = "purge" ]; then
    # Remove user
    if id -u lanchat > /dev/null 2>&1; then
        userdel lanchat || true
    fi

    # Remove data directory
    rm -rf /var/lib/lanchat || true

    echo "LANChat Server data removed."
fi

# Reload systemd
systemctl daemon-reload || true

exit 0
